using System;
namespace ch.ethz.ssh2.packets
{
	
	
	/// <summary> PacketOpenDirectTCPIPChannel.
	/// 
	/// </summary>
	/// <author>  Christian Plattner
	/// </author>
	/// <version>  2.50, 03/15/10
	/// </version>
	public class PacketOpenDirectTCPIPChannel
	{
		virtual public byte[] Payload
		{
			get
			{
				if (payload == null)
				{
					TypesWriter tw = new TypesWriter();
					
					tw.writeByte(Packets.SSH_MSG_CHANNEL_OPEN);
					tw.writeString("direct-tcpip");
					tw.writeUINT32(channelID);
					tw.writeUINT32(initialWindowSize);
					tw.writeUINT32(maxPacketSize);
					tw.writeString(host_to_connect);
					tw.writeUINT32(port_to_connect);
					tw.writeString(originator_IP_address);
					tw.writeUINT32(originator_port);
					
					payload = tw.getBytes();
				}
				return payload;
			}
			
		}
		internal byte[] payload;
		
		internal int channelID;
		internal int initialWindowSize;
		internal int maxPacketSize;
		
		internal System.String host_to_connect;
		internal int port_to_connect;
		internal System.String originator_IP_address;
		internal int originator_port;
		
		public PacketOpenDirectTCPIPChannel(int channelID, int initialWindowSize, int maxPacketSize, System.String host_to_connect, int port_to_connect, System.String originator_IP_address, int originator_port)
		{
			this.channelID = channelID;
			this.initialWindowSize = initialWindowSize;
			this.maxPacketSize = maxPacketSize;
			this.host_to_connect = host_to_connect;
			this.port_to_connect = port_to_connect;
			this.originator_IP_address = originator_IP_address;
			this.originator_port = originator_port;
		}
	}
}